
def f(i):
    x=i
    cnt=0
    while x:
        cnt+=x%4
        x=x//4
    # print(cnt)
    return cnt
n=2025
ans=0
for i in range(1,n):
    x=list(map(int,bin(i)[2:].strip()))
    y=f(i)
    if sum(x)==y:
        ans+=1

print(ans)